package com.dzsw.strings;

import java.util.Optional;

/**
 * @author sunz
 * @version 1.0
 * @CreateTime 2021-05-27-16:35
 */
public class OptionalDemo {

    public static void main(String[] args) {
        String s = null;
        Optional<String> optional = Optional.ofNullable(s);
        System.out.println(optional.orElse("ss"));

        Optional<String> op1 = Optional.empty();
        System.out.println(op1.orElse("tttt"));
    }
}
